<!--
 * @Autor: dingxiaolin
 * @Date: 2021-09-23 07:31:53
 * @LastEditors: dingxiaolin
 * @LastEditTime: 2021-11-13 16:56:51
-->
<template>
    <div class="dashboard-container">
        <div class="header">
            <h5 class="title">大数据看板</h5>
            <div class="time">
                {{ time }}
                <span style="margin: 0 10px">|</span>
                <div class="date">
                    <div>{{ date }}</div>
                    <div>{{ week }}</div>
                </div>
            </div>
        </div>
        <div class="charts flex" style="height: 45%; justify-content: space-between">
            <div style="width: 30%; height: 100%" class="border">
                <pieChart></pieChart>
            </div>
            <div style="width: 39%; height: 100%" class="border">
                <barsChart></barsChart>
            </div>
            <div style="width: 30%; height: 100%" class="border">
                <barChart></barChart>
            </div>
        </div>
        <div class="charts" style="width: 100%; height: 45%; margin-top: 8px">
            <div style="width: 100%; height: 100%" class="border">
                <salesChart></salesChart>
            </div>
        </div>
    </div>
</template>

<script>
import salesChart from './charts/salesChart';
import pieChart from './charts/pieChart';
import barChart from './charts/barChart';
import barsChart from './charts/barsChart';
import { Vue, Component, Prop, Emit } from 'vue-property-decorator';
import dayjs from 'dayjs';
import { api } from '@/http/api';
import { Type } from '@/http/interface';
@Component({
    components: {
        salesChart,
        pieChart,
        barChart,
        barsChart,
    },
})
export default class Dashboard extends Vue {
    time = '';
    date = '';
    week = '';
    timer = null;
    mounted() {
        this.timer = setInterval(() => {
            let Time = new Date();
            this.date = Time.getFullYear() + '-' + (Time.getMonth() + 1) + '-' + Time.getDate(); //兼容IE
            this.week = this.getWeekDate();
            this.time = dayjs(Time).format('HH:mm:ss');
        }, 1000);
    }
    beforeDestroy() {
        clearInterval(this.timer);
    }
    getWeekDate() {
        var now = new Date();
        var day = now.getDay();
        var weeks = new Array('星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六');
        var week = weeks[day];
        return week;
    }
}
</script>

<style lang="scss" scoped>
.dashboard-container {
    width: 100%;
    height: 100%;
    padding: 20px;
    background-color: #1f2942;
    text-align: center;
    display: flex;
    flex-direction: column;
    .header {
        width: 100%;
        height: 8%;
        background: url('~@/assets/img/boardNav.png') no-repeat;
        background-size: 100% 100%;
        display: flex;
        position: relative;
        .title {
            font-family: YouSheBiaoTiHei;
            font-size: 34px;
            color: #fff;
            letter-spacing: 4px;
            text-align: center;
            margin: 0;
            position: absolute;
            top: 50%;
            left: 50%;
            font-weight: 400;
            -webkit-transform: translate(-50%, -60%);
            transform: translate(-50%, -60%);
        }
        .time {
            margin-left: auto;
            font-size: 32px;
            color: #fff;
            margin-right: 50px;
            display: flex;
            align-items: center;
            justify-content: center;
            .date {
                font-size: 14px;
                display: flex;
                flex-direction: column;
                align-items: center;
                justify-content: center;
            }
        }
    }
    .charts {
        margin-top: 1%;
        display: flex;
        .border {
            width: 100%;
            height: 100%;
            background: url('~@/assets/img/border.png') no-repeat;
            background-size: 100% 100%;
        }
        .video {
            width: 90%;
            height: 8%;
            margin: 0 auto;
            margin-bottom: 2%;
            display: flex;
            justify-content: space-between;
            span {
                font-size: 16px;
                color: #fff;
            }
            .arrow {
                height: 100%;
            }
        }
    }
    .ant-row {
        height: 50%;
        .ant-col {
            height: 100%;
        }
    }
}
</style>
